/**
* User: Oleksii Savchenko
* Date: 23.01.13
* Time: 14:21
*/
describe('Should change the page', function(){
    describe('Before: Should check a private function of collecting object', function(){
        it("can set property to any object", function(){
            var fakeObj = {};
            var fakeKey = 'href';
            var fakeVariable = 'fake';

            navigation._setProperty(fakeObj, fakeKey, fakeVariable);
            expect(fakeObj.href).toBe(fakeVariable);
        });

        it('can output error, if set undefined', function(){
            var fakeObj = {};
            var fakeKey = 'href';
            var fakeVariable = undefined;

            expect(function(){(navigation._setProperty(fakeObj, fakeKey, fakeVariable))}).toThrow();
        });

        it('can output error, if set null', function(){
            var fakeObj = {};
            var fakeKey = 'href';
            var fakeVariable = null;

            expect(function(){(navigation._setProperty(fakeObj, fakeKey, fakeVariable))}).toThrow();
        });
    });



    beforeEach(function(){

    });
    afterEach(function(){

    });

    it('Should made redirect by Url', function(){
        var stub = sinon.stub(navigation, '_setProperty');
        var url = '/server/page';
        navigation.goToPage(url);

        expect(stub).toHaveBeenCalledWith(location, "href", url);
        stub.restore();
    });


});